package com.opencee.boot.autoconfigure.amqp.autoconfigure;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Exchange;
import org.springframework.amqp.core.ExchangeBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author yadu
 */
@Slf4j
@Configuration
public class AmqpAutoConfiguration {


    @Bean
    public Exchange topicExchange() {
        log.info("默认topic消息总线:topicExchange=" + AmqpConstants.TOPIC_EXCHANGE);
        //声明了一个Topic类型的交换机，durable是持久化（重启rabbitmq这个交换机不会被自动删除）
        return ExchangeBuilder.topicExchange(AmqpConstants.TOPIC_EXCHANGE).durable(true).build();
    }

}
